import uniqueId from '@form-create/utils/lib/unique';
import {localeProps, makeRequiredRule} from '../../utils';

const label = '金额';
const name = 'jd-money';

export default {
    icon: 'icon-money',
    label,
    name,
    rule({t}) {
        return {
            type: 'inputNumber',
            field: 'JE',
            title: '金额',
            info: '',
            $required: false,
            validate: false,
            style: {
                width: '100%',
            },
            props: {
                precision: 2,
                controls: false,
                controlsPosition:'right'
            }
        };
    },
    props(_, {t}) {
        return localeProps(t, name + '.props', [
            {type: 'input', field: 'placeholder', title: '占位文本'},
            makeRequiredRule(), 
            {
                type: 'col',
                props: {span: 12},
                children: [
                    {type: 'switch', field: 'controls', title: '隐藏控制', value: true, props: {activeValue: false, inactiveValue: true}},
                ]
            },
            {
                type: 'col',
                props: {span: 12},
                children: [
                    {type: 'switch', field: 'controlsPosition', title: '右侧显示', value:'right', props: {activeValue: 'right', inactiveValue: 'default'}},
                ]
            },
            {
                type: 'row',
                props: {gutter: 5},
                children: [
                    {
                        type: 'col',
                        props: {span: 12},
                        children: [
                            {type: 'inputNumber', field: 'max', title: '最大值', props: {min: 0}}
                        ]
                    },
                    {
                        type: 'col',
                        props: {span: 12},
                        children: [
                            {type: 'inputNumber', field: 'step', title: '步长', props: {min: 0}}
                        ]
                    }
                ]
            },
            {
                type: 'col',
                props: {span: 12},
                children: [
                    {type: 'switch', field: 'disabled', title: '是否禁用'}, 
                ]
            },
            {
                type: 'col',
                props: {span: 12},
                children: [
                    {type: 'switch', field: 'readonly', title: '是否只读'}, 
                ]
            },
        ]);
    }
};
